<?php 

/**
 * Class moveto Uninstall
 * Uninstalling moveto deletes user roles, tables, and options.
 *
 * @author      TeamBI
 */
 
	class moveto_uninstall{


		  /* remove all roles */
		  function remove_mp_roles() {
			   remove_role('mp_staff'); 
			   remove_role('mp_manager'); 
			   remove_role('mp_client');
		  }  
		  
		  
		  /* Remove database tables */
		  function remove_mp_mysql_tables() {			
				global $wpdb;				
			 $wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_bookings" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_email_templates" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_order_client_info" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_article_category" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_articles" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_additional_info" );
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_sms_templates");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_elevator");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_floors");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_cubicfeets");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_movesize");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_packaging_unpackagin");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_room_type");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_cities");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_distance");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_pricing_rules");
				$wpdb->query( "DROP TABLE IF EXISTS ".$wpdb->prefix."mp_schedule_dayoffs");
		  }
		  /* remove wordpress options by moveto */
		  function remove_mp_wp_options() {
				global $wpdb;
				$wpdb->query("DELETE FROM ".$wpdb->prefix."options WHERE option_name LIKE 'moveto_%'");
		  }
			 
		  /* remove wordpress users */ 
		  function remove_mp_mysql_users() {
				global $wpdb;
		    $wpdb->query("DELETE FROM ".$wpdb->prefix."users WHERE `".$wpdb->prefix."users`.`user_email` = 'johnmartin@demo.com'");
				$wpdb->query("DELETE FROM ".$wpdb->prefix."users WHERE `".$wpdb->prefix."users`.`user_email` = 'jamie@gmail.com'");
				$wpdb->query("DELETE FROM ".$wpdb->prefix."users WHERE `".$wpdb->prefix."users`.`user_email` = 'lindasmith@gmail.com'");
				
		  }
			 
		   /* remove moveto pages */
		  function remove_mp_wp_pages() {
				$pageTY = get_page_by_title( 'thankyou' );
				if($pageTY!=''){
					wp_trash_post($pageTY->ID);
				}
		  }		  
		 
	  
	}
?>